package com.example;

import com.example.entity.Teacher;
import com.example.service.TeacherService;
import com.example.utils.ExcelReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.io.IOException;

@Controller
@SessionAttributes("excelData")
public class MainController        //主管界面逻辑跳转//
{
    @RequestMapping("/Main")
    public String Main()
    {
        return "Main";
    }
    @RequestMapping(value="/login")
    public String str(String s) {return "login";}
    @GetMapping("/User")
    public String toUser()
    {
        return "User";
    }
    @GetMapping("/Photo")
    public String toPhoto()
    {
        return "Photo";
    }
    @GetMapping("/Attendance")
    public String toAttendance()
    {
        return "Attendance";
    }
    //教师查询结果//
    @Autowired
    private TeacherService teacherService;
    @RequestMapping("/Teacher")
    public String Teacher(ModelMap map)
    {
        List<Teacher> teachers = teacherService.getAllTeachers();
        map.addAttribute("teachers",teachers);
        return "Teacher";
    }
    @RequestMapping("/Register")
    public String toRegister()
    {
        return "Register";
    }
    @RequestMapping("/TimeControl")
    public String toTimeControl()
    {
        return "TimeControl";
    }
    @RequestMapping("/Score")
    public String toScore()
    {
        return "Score";
    }
}
